const swaggerJSDoc = require('swagger-jsdoc');
const path = require('path'); // 引入path模块
const { servers, components } = require('@/config/swagger.config')

const swaggerOptions = {
  swaggerDefinition: {
    openapi: '3.0.0',
    info: {
      title: 'My API',
      version: '1.0.0',
      description: 'API 文档示例',
    },
    servers,
    components,
    security: [
      {
        authorization: ['Bearer ']
      }
    ]
  },
  apis: [path.join(__dirname, '../routes/*.js')], // 使用绝对路径
};

const specs = swaggerJSDoc(swaggerOptions);

module.exports = specs;